Fix asyncio error when opening notebooks by dleen · Pull Request #718 · jupyter/jupyter

您所在的位置:网站首页 jupyter import py Fix asyncio error when opening notebooks by dleen · Pull Request #718 · jupyter/jupyter

Fix asyncio error when opening notebooks by dleen · Pull Request #718 · jupyter/jupyter

#Fix asyncio error when opening notebooks by dleen · Pull Request #718 · jupyter/jupyter| 来源: 网络整理| 查看: 265

Just to be clear: by initializing nest_asyncio in notebook it has resolved the issue this PR originally set out to solve. So if you want to try you can upgrade notebook==6.4.6 and get the latest jupyter_client and see if you still have the issue.

I was able to reproduce this issue easily enough using notebook==6.4.4 and any jupyter_client > 7. It requires you to be quick, but if you launch the notebook server, create a new notebook from the tree view, wait for the new tab to open, and as quickly as possible execute some code e.g. 1 + 1 then in the notebook server log you should see an Exception being thrown for the event loop.

If you aren't using notebook then you can investigate adding:

import nest_asyncio nest_asyncio.apply()

to your application code to initialize it as early as possible: before launching any tasks.

Even better would be migrating your application to only use the asynchronous methods of jupyter_client and not relying on the sync ones.

But that's a question for you too -- is it possible in real applications / practical to use Jupyter w/o nest_asyncio?

I'm not an expert on this either, but my understanding is that this nest_asyncio stuff is only needed to maintain compatibility with the older sync code. If you can rely only on the async ones then in theory you won't ever hit the code that needs nested loops.

You don't consider this to be an option?

It would require a long deprecation cycle I believe:

Identify all applications/consumers of jupyter_client For each consumer: either introduce nest_asyncio or remove the sync dependencies Release a new version of each Wait for users to move onto the new version Remove the code from jupyer_client


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3